#include "app_buff.h"

int main(int argc, char *argv[])
{
    // 初始化缓冲区
    buffer_t *buff = app_buff_init(1024);
    // 创建一个字符串 并写入缓冲区
    char *str = "hello buff";
    app_buff_write(buff, str, strlen(str));

    str = "hello buffabc";
    app_buff_write(buff, str, strlen(str));

    // 读取缓冲区
    char read_str[100];
    int read_len = app_buff_read(buff,read_str, 100);
    log_info("read_len:%d, read_str:%s\n", read_len, read_str);

    char read_str2[100];
    read_len = app_buff_read(buff,read_str2, 100);
    log_info("read_len:%d, read_str:%s\n", read_len, read_str2);

    app_buff_destroy(buff);
}